import Express from 'express'
import Captcha from 'svg-captcha'
export const captchaRouter = Express.Router()
captchaRouter.get('/',async(req,res)=>{
    const obj = Captcha.create({
        size:4,
        ignoreChars:'0o1i',
        noise:0,
        color: true
    });
    req.session.code = obj.text
    console.log(obj.text);
    // 相同的返回结果{code，msg，data}
    // res.send(obj.data)
    res.json({
        code:0,
        data:obj.data,
        msg:'ok'
    })
})